package com.easyjava.qingke.memo.util;

import java.util.Scanner;

public class MemoConsole {
	private static Scanner scanner = new Scanner(System.in);
	
	public MemoConsole(){}
	
	
	public static void println(){
		System.out.println();
	}
	
	public static void println(String str){
		System.out.println(str);
	}
	public static void println(Object obj){
		System.out.println(obj);
	}
	public static String promptN(String str){
		while(true){
			System.out.println(str);
			String st = scanner.nextLine().trim();
			return st;
		}
	}
	public static String prompt(String str){
		while(true){
			System.out.println(str);
		    String st = scanner.nextLine().trim();
		    
		    if(!"".equals(st)){
		    	return st;
		    }else 
		    	System.out.println("Invalid input.Empty value is not allowed");
		}
	}
	public static int promptInt(String prompt){
		int result =-1;
		while(true){
			String out = prompt(prompt);
			try{
			result=Integer.parseInt(out);
			}catch(Exception e){
				System.out.println("请输入合法数字");
			}
			if(result !=-1){
				break;
			}
		}
		return result;
		
	}

}
